package org.yefei.homeworkday22;

import java.util.Scanner;

public class Four {
	public static void main(String[] args) {
		// 4、输入两个字符串，判断第二个在第一个中出现的次数。
		Scanner in = new Scanner(System.in);
		System.out.println("请输入第一个字符串：");
		String first = in.next();
		System.out.println("请输入第二个字符串：");
		String second = in.next();
		int count = 0;
		while (true) {
			int indexOf = first.indexOf(second);
			if (indexOf < 0) {
				break;
			} else {
				first = first.substring(indexOf + second.length());
				count++;
			}
		}
		System.out.println(second + "  在  " + first + "中出现了：" + count + "次。");
	}
}
